Next: Editing source code, Previous: Working With Source Code, Up: Working With Source Code [Contents][Index]
Live code blocks can be specified with a ‘src’ block or inline.168 The structure of a ‘src’ block is
#+NAME: <name> #+BEGIN_SRC <language> <switches> <header arguments> <body> #+END_SRC
The #+NAME: line is optional, and can be used to
name the code block. Live code blocks require that a language be
specified on the #+BEGIN_SRC line. Switches and
header arguments are optional.
Live code blocks can also be specified inline using
src_<language>{<body>}
or
src_<language>[<header arguments>]{<body>}
<#+NAME: name>This line associates a name with the code block. This is
similar to the #+NAME: Name lines that can be
used to name tables in Org mode files. Referencing the name
of a code block makes it possible to evaluate the block from
other places in the file, from other files, or from Org mode
table formulas (see The spreadsheet).
Names are assumed to be unique and the behavior of Org mode
when two or more blocks share the same name is undefined.
<language>The language of the code in the block (see Languages).
<switches>Optional switches control code block export (see the discussion of switches in Literal examples)
<header arguments>Optional header arguments control many aspects of evaluation, export and tangling of code blocks (see Header arguments). Header arguments can also be set on a per-buffer or per-subtree basis using properties.
source code, header arguments<body>Source code in the specified language.
Next: Editing source code, Previous: Working With Source Code, Up: Working With Source Code [Contents][Index]